<?php 
/**[图片集表服务层模型]
 * @Author: chen
 * @Date:   2014-08-17 18:00:43
 * @Last Modified by:   chenli
 * @Last Modified time: 2015-03-05 23:51:16
 */
class PicService extends Model{

	protected $tableName = 'article_pic';
	/**
	 * [find_all_by_article_aid 读取图片集 通过 关联外键article_aid]
	 * @param  [type] $aid [description]
	 * @return [type]      [description]
	 */
	public function find_all_by_article_aid($aid)
	{
		$data = D('ArticlePic')->where(array('article_aid'=>$aid))->select();
		if(!$data) return false;
		// 图片路径
		foreach($data as $k=>$v)
		{
			$data[$k]['small']  = __ROOT__.'/'.$v['small'];
			$data[$k]['medium'] = __ROOT__.'/'.$v['medium'];
			$data[$k]['big']    = __ROOT__.'/'.$v['big'];
		}
		return $data;
	}
}

 ?>